// D3D9VertexDeclaration.h

#ifndef __D3D9VERTEXDECLARATION_H__
#define __D3D9VERTEXDECLARATION_H__

#include <list>

class CD3D9VertexDeclaration
{
private:
	typedef std::list<D3DVERTEXELEMENT9> VertexElementList;
	VertexElementList m_ElementList;
	LPDIRECT3DDEVICE9 m_pDevice;
	LPDIRECT3DVERTEXDECLARATION9 m_pDecl;
	bool m_bNeedsRebuild;
public:
	CD3D9VertexDeclaration(LPDIRECT3DDEVICE9 device);
	~CD3D9VertexDeclaration();

	void AddElement(
		WORD Stream,
		WORD Offset,
		BYTE Type,
		BYTE Method,
		BYTE Usage,
		BYTE UsageIndex);

	void InsertElement(
		WORD Stream,
		WORD Offset,
		BYTE Type,
		BYTE Method,
		BYTE Usage,
		BYTE UsageIndex,
		unsigned short usIndex);

	LPDIRECT3DVERTEXDECLARATION9 getD3DVertexDeclaration(void);
};

#endif